<template>
  <div class="app-container">
    <div class="filter-container">
      <el-page-header @back="backUp" class="backUp" content="导入记录详情"></el-page-header>
    </div>
    <el-table
      v-if="queryParam.type==1"
      :data="data"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      border
    >
      <el-table-column  label="用户名" align='center'>
        <template slot-scope="item">
          {{getVal(item.row,'username')}}
        </template>  
      </el-table-column>
      <el-table-column  label="账号" align='center'>
        <template slot-scope="item">
          {{getVal(item.row,'mobile')}}
        </template>  
      </el-table-column>
      <el-table-column  label="导入状态" align='center'>
        <template slot-scope="item">
          {{item.row.is_success == 1 ? '成功': '失败'}}
        </template>  
      </el-table-column>
      <el-table-column prop="fail_remake" label="备注" align='center'/>
      <el-table-column prop="create_time" label="导入时间" align='center'/>
    </el-table>
    <el-table
      v-else-if="queryParam.type==2"
      :data="data"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      border
    >
      <el-table-column prop="id" label="序号"  align='center' width='60px'/>
      <el-table-column  label="账号" align='center' width='100px'>
        <template slot-scope="item">{{getVal(item.row,'mobile')}}</template>  
      </el-table-column>
      <el-table-column  label="姓名" align='center' width='100px'>
        <template slot-scope="item">{{getVal(item.row,'full_name')}}</template>  
      </el-table-column>
      <el-table-column  label="年龄" align='center' width='60px'>
        <template slot-scope="item">{{getVal(item.row,'age')}}</template>  
      </el-table-column>
      <el-table-column  label="职位类型" align='center'>
        <template slot-scope="item">{{getVal(item.row,'post_type')}}</template>  
      </el-table-column>
      <el-table-column  label="驾驶证号（选填）" align='center' width='180px'>
        <template slot-scope="item">{{getVal(item.row,'drive_number')}}</template>  
      </el-table-column>
      <el-table-column  label="准驾车型" align='center' width='90px'>
        <template slot-scope="item">{{getVal(item.row,'driving_model')}}</template>  
      </el-table-column>
      <el-table-column  label="驾龄/工作经验" align='center'>
        <template slot-scope="item">{{getVal(item.row,'work_exp')}}</template>  
      </el-table-column>
      <el-table-column  label="工作城市" align='center'>
        <template slot-scope="item">{{getVal(item.row,'province_name')}}{{getVal(item.row,'city_name')}}{{getVal(item.row,'district_name')}}</template>  
      </el-table-column>
      <el-table-column  label="期望薪资" align='center'>
        <template slot-scope="item">
          <p v-if="getVal(item.row,'salary_type_name')=='薪资面议'">{{getVal(item.row,'salary_type_name')}}</p>
          <p v-else>{{getVal(item.row,'min_money')}}-{{getVal(item.row,'max_money')}}</p>
        </template>  
      </el-table-column>
      <el-table-column  label="导入状态" align='center' width='90px'>
        <template slot-scope="item">
          {{item.row.is_success == 1 ? '成功': '失败'}}
        </template>  
      </el-table-column>
      <el-table-column prop="fail_remake" label="备注" align='center' width='160px'/>
      <el-table-column prop="create_time" label="导入时间" align='center' width='130px'/>
    </el-table>
    <el-table
      v-else-if="queryParam.type==4"
      :data="data"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      border
    >
      <el-table-column prop="id" label="序号"  align='center'/>
      <el-table-column  label="账号" align='center'>
        <template slot-scope="item">{{getVal(item.row,'mobile')}}</template>  
      </el-table-column>
      <el-table-column  label="公司名称" align='center'>
        <template slot-scope="item">{{getVal(item.row,'name')}}</template>  
      </el-table-column>
      <el-table-column  label="职位类型" align='center'>
        <template slot-scope="item">{{getVal(item.row,'post_type')}}</template>  
      </el-table-column>
      <el-table-column  label="工作类型" align='center'>
        <template slot-scope="item">{{getVal(item.row,'work_type')}}</template>  
      </el-table-column>
      <el-table-column  label="薪资范围" align='center'>
        <template slot-scope="item">
          <p v-if="getVal(item.row,'salary_type_name')=='薪资面议'">{{getVal(item.row,'salary_type_name')}}</p>
          <p v-else>{{getVal(item.row,'min_money')}}-{{getVal(item.row,'max_money')}}</p>
        </template>  
      </el-table-column>
      <el-table-column  label="福利待遇" align='center'>
        <template slot-scope="item">{{getVal(item.row,'trea')}}</template>  
      </el-table-column>
      <el-table-column  label="工作城市" align='center'>
        <template slot-scope="item">{{getVal(item.row,'province_name')}}{{getVal(item.row,'city_name')}}{{getVal(item.row,'district_name')}}</template>  
      </el-table-column>
      <el-table-column  label="年龄范围" align='center'>
        <template slot-scope="item">{{getVal(item.row,'age_type')}}</template>  
      </el-table-column>
      <el-table-column  label="经验要求" align='center'>
        <template slot-scope="item">{{getVal(item.row,'exp_type')}}</template>  
      </el-table-column>
      <el-table-column  label="岗位职责（选填）" align='center'>
        <template slot-scope="item">{{getVal(item.row,'duty')}}</template>  
      </el-table-column>
      <el-table-column  label="招聘人数" align='center'>
        <template slot-scope="item">{{getVal(item.row,'number_recruiters')}}</template>  
      </el-table-column>
      <el-table-column  label="联系人姓名" align='center'>
        <template slot-scope="item">{{getVal(item.row,'contacts')}}</template>  
      </el-table-column>
      <el-table-column  label="联系人电话" align='center'>
        <template slot-scope="item">{{getVal(item.row,'contacts_mobile')}}</template>  
      </el-table-column>
      <el-table-column  label="公司logo（选填）" align='center'>
        <template slot-scope="item">{{getVal(item.row,'company_logo')}}</template>  
      </el-table-column>
      <el-table-column  label="公司介绍（选填）" align='center'>
        <template slot-scope="item">{{getVal(item.row,'desc')}}</template>  
      </el-table-column>
      <el-table-column  label="工作环境（选填）" align='center'>
        <template slot-scope="item">{{getVal(item.row,'company_img')}}</template>  
      </el-table-column>
      <el-table-column  label="导入状态" align='center'>
        <template slot-scope="item">
          {{item.row.is_success == 1 ? '成功': '失败'}}
        </template>  
      </el-table-column>
      <el-table-column prop="fail_remake" label="备注" align='center'/>
      <el-table-column prop="create_time" label="导入时间" align='center'/>
    </el-table>
    <el-pagination
      background
      class="pagination-container"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="paginate.current"
      hide-on-single-page
      :page-sizes="paginate.sizes"
      :page-size="paginate.limit"
      :layout="paginate.layout"
      :total="paginate.total"/>
  </div>
</template>

<script>
import formOperate from '@/layout/mixin/formOperate'
export default {
  name: 'Index',
  mixins: [formOperate],
  data() {
    return {
      url:'/profession/admin/Import',
      queryParam:{
        type:'',
        page_index:1,
        page_size:10,
        import_id:'',
        request_type:'2'
      }
    }
  },
  mounted() {
   this.queryParam.type = this.$route.query.type
   this.queryParam.import_id = this.$route.query.id
  },
  methods: {
    getVal(item,key) {
      if (item.data_json == '' || item.data_json == '[]') return ''
      let data = JSON.parse(item.data_json)
      return data[key]
    },
    backUp() {
      this.$router.go(-1)
    }
  }
}
</script>
